package ch.epfl.lara.matcheck.ast;

  //Extractor for Arithmetic Expr
  object ArithBinaryExpr {
    def unapply(o: Operator): Option[(Expr,Expr)] = o match { 
      case +(left,right) => Some(left,right)
      case -(left,right) => Some(left,right)
      case *(left,right) => Some(left,right)
      case /(left,right) => Some(left,right)
      case %(left,right) => Some(left,right)
      case _ => None
    }
  }

  //Extractor for Comparison expr
  object CmpBinaryExpr {
    def unapply(o: Operator): Option[(Expr,Expr)] = o match {
      case ==(left,right) => Some(left,right)
      case <=(left,right) => Some(left,right)
      case <(left,right)  => Some(left,right)
      case _              => None
    }
  }

  //Extractor for Boolean expr
  object BoolBinaryExpr {
    def unapply(o: Operator): Option[(Expr,Expr)] = o match {
      case &&(left,right) => Some(left,right)
      case ||(left,right) => Some(left,right)
      case ->(left,right) => Some(left,right)
      case _              => None
    } 
  }

  //Extractor for Binary expr
  object BinaryExpr {
    def unapply(o: Operator): Option[(Expr,Expr)] = o match {
     case ArithBinaryExpr(left,right) => Some(left,right)
     case CmpBinaryExpr(left,right)   => Some(left,right)
     case BoolBinaryExpr(left,right)  => Some(left,right)
     case _                           => None
    }
  }

